<li style="width:30%">
      <div class="table-responsive div_building div_search">                        
            <table class="table table-th-block table-hover">                                
                 <thead>
                       <tr>                                        
                             <th colspan="2">楼座列表</th>
                       </tr>                           
                 </thead>
                 <tbody>
                        <foreach name="building" item="value">                                 
                             <tr>
                                  <td class="build" name="{$value.building_id}">{$value.building_name}</td>
                                  <td style="width:100px;text-align:center" name="{$value.building_id}" >
                                  	<a class="saveb" name="{$value.local_id}">修改</a>/
                                    <a  href="javascript:void(0)" onclick="to_del(2,{$value.building_id})">删除</a></td>
                             </tr>
                       </foreach>
                 </tbody>                                  
            </table>
            <ul class="pagination success">{$rs.show}</ul>
      </div>
</li>
<div id="floor">
    <li style="width:30%">
          <div class="table-responsive div1 div_search">                          
                <table class="table table-th-block table-hover">                                
                     <thead>
                           <tr>                                        
                                 <th colspan=2>楼层列表</th>
                           </tr>                           
                     </thead>
                     <tbody>
                           <foreach name="floor" item="value">                                 
                                 <tr>
                                       <td class="{$value.floor_id}">{$value.floor_name}</td>
                                       <td style="width:100px;text-align:center" name="{$value.floor_id}">
                                       	<a class="savef" name="{$value.building_id}">修改</a>/
                                        <a href="javascript:void(0)" onclick="to_del(3,{$value.floor_id})">删除</a>
                                       </td>
                                 </tr>
                           </foreach>
                     </tbody>
                </table>
                <ul class="pagination success">{$rs.show}</ul>
          </div>                    
    </li>
</div>
<script>
$(".build").eq(0).css({background:"#8CC152"});
    //楼座选择
 $(".build").click(function(){    
     var building_id = $(this).attr("name");
     $(".build").css({background:""});
     $(this).css({background:"#8CC152"});    
      $.ajax({
      url:"__URL__/floor",
      data:{"building_id":building_id},
      type:"post",
      success:function(data){
        $("#floor").html(data);
      }
    });
  });

$(".sub_remove").click(function(){
      $(".back").css({display:"none"});
      $(".the-box").css({display:"none"});

});

//楼座修改
$(".saveb").click(function(){
      var building_id = $(this).parent().attr("name");
      var building_name = $(this).parent().prev().text();
      var local_id = $(this).attr("name");        
      $(".city_check option[value="+local_id+"]").attr("selected","selected");
      $("#building_id").val(building_id);
      $(".building").val(building_name);     
      $(".back").css({display:"block"});
      $(".update_build").css({display:"block"});
});


//楼层修改
$(".savef").click(function(){
      var local_id = city_id;      
      var floor_id =$(this).parent().prev().attr("class");
      var floor_name =$(this).parent().prev().text();
      var building_id = $(this).attr("name");     
      $.ajax({
        url:"__URL__/build_floor",
        data:{"local_id":local_id},
        type:"post",
        success:function(data){
          $(".build_floor").html(data);
          $(".build_floor option[value="+building_id+"]").attr("selected","selected");
        }
      });      
      $(".city_check option[value="+local_id+"]").attr("selected","selected");
      
      $("#floor_id").val(floor_id);
      $("#floor_name").val(floor_name);     
      $(".back").css({display:"block"});
      $(".update_floor").css({display:"block"});
});
//楼层修改城市选择

</script>

